//package org.example.stream;
//
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.beans.factory.annotation.Qualifier;
//import org.springframework.data.redis.connection.stream.MapRecord;
//import org.springframework.data.redis.connection.stream.PendingMessagesSummary;
//import org.springframework.data.redis.core.RedisTemplate;
//import org.springframework.data.redis.stream.StreamListener;
//import org.springframework.stereotype.Component;
//
///**
// * redis stream监听消息
// */
//@Component
//public class ListenerMessage implements StreamListener<String, MapRecord<String, String, String>> {
//    @Autowired
//    @Qualifier("redisTemplate2")
//    private RedisTemplate<String, Object> redisTemplate;
//    @Override
//    public void onMessage(MapRecord<String, String, String> message) {
//        // 接收到消息
//
//        System.out.println("message ListenerMessage " );
//        System.out.println("message id " + message.getId());
//        System.out.println("stream " + message.getStream());
//        System.out.println("body " + message.getValue());
//        PendingMessagesSummary pendingSummary = redisTemplate.opsForStream().pending( message.getStream(), "group2");
//        System.out.println(pendingSummary);
//    }
//
//}